package com.caigp.cookbook2.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.caigp.cookbook2.R;
import com.caigp.cookbook2.bean.Favorite;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;

import java.util.List;

public class FavoriteAdapter extends BaseQuickAdapter<Favorite, BaseViewHolder> {
    public FavoriteAdapter(int layoutResId, @Nullable List<Favorite> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Favorite item) {
        helper.setText(R.id.name, item.getName());
        Glide.with(mContext).load(item.getPic()).placeholder(R.drawable.load).error(R.drawable.error).into((RoundedImageView) helper.getView(R.id.pic));
    }
}
